/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modele;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author ltata
 */
public class Pays {
    private Collection <Deps> lesDeps;
    private Collection <Specialite> lesSpes;
    
    
    
    public Pays() {
        Collection <Med> lesMeds = DAO.getLesMeds();
        lesDeps = DAO.getLesDeps();
        lesSpes = DAO.getLesSpes();
        
        for (Med unMed : lesMeds){
            Deps unDep = getLeDep(unMed.getDep());
            unDep.addUnMed(unMed);
            Specialite uneSpe = getLaSpe(unMed.getSpe());
            if (uneSpe != null){
                uneSpe.addUnMed(unMed);
            }
        }
    }

    public Collection<Deps> getLesDeps() {
        return lesDeps;
    }
    
    public Deps getLeDep(String num) {
        for(Deps leDep : lesDeps){
            if (num.equals(leDep.getNum())) {
                return leDep;
            }
        }
        return null;
    }

    public Collection<Specialite> getLesSpes() {
        return lesSpes;
    }
    

    public Specialite getLaSpe(String spe) {
        for(Specialite uneSpe : lesSpes){
            if (uneSpe.getNom().equals(spe) ){
                return uneSpe;
            }
        }
        return null;
    }
    
}
